/**
* component Dropdown
* prefix: .mui-dropdown
*/
@import '../lib/styles/form-input.less';

.mui-dropdown {
  position: relative;
  display: inline-block;
  width: 172px;

  .colortag {
    width: 8px;
    height: 8px;
    border-radius: 8px;
    margin: 14px -6px 0 12px;
  }
  button .colortag {
    margin: 6px 10px 0 1px;
  }
  .mui-forminput {
    width: 100%;
  }

  .mui-dropdown-menu {
    display: none;
    position: absolute;
    left: 0;
    top: 100%;
    z-index: 100;
  }

  &.mui-dropdown-open {
    .mui-dropdown-menu {
      display: block;
    }
  }
}

.mui-dropdown-menu {
  padding: 6px 0;
  width: 220px;
  background-color: #fff;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.13), 0 2px 6px rgba(0, 0, 0, 0.1);
  border-radius: 3px;
  user-select: none;

  & > .mui-dropdown-li {
    font-size: 13px;
    line-height: 20px;
    color: #333;
    cursor: pointer;
    display: flex;

    & > div {
      display: flex;
      flex: 1;

      & > .mui-dropdown-label {
        display: inline-block;
        padding: 0 15px;
        flex: 1;
        vertical-align: middle;
      }
    }

    &.mui-dropdown-divider {
      height: 13px;
      padding: 0;
      position: relative;
      cursor: default;
      &:after {
        content: '';
        display: block;
        height: 1px;
        width: 100%;
        background-color: #e0e0e0;
        position: absolute;
        left: 0;
        top: 6px;
      }
      &:hover,
      &.mui-dropdown-checked {
        color: transparent;
      }
    }
    &.mui-dropdown-nav {
      color: #333;
      cursor: default;
      padding: 6px 12px;
      & div:hover,
      &.mui-dropdown-checked {
        color: #333;
      }

      .mui-dropdown-label {
        padding: 0;
      }

      &.mui-dropdown-back {
        cursor: pointer;
        .mui-dropdown-label {
          & div:hover {
            color: #333;
          }
        }

        i.icon {
          font-size: 14px;
          line-height: 20px;
          width: 20px;
          text-align: center;
          vertical-align: middle;
          color: #95989a;
          box-sizing: content-box;
        }
      }

      i.icon {
        padding: 0;
        color: #333 !important;
        float: none;
      }

      button {
        border: none;
        padding: 0 6px;
        font-size: 13px;
        line-height: 20px;
        height: 20px;
        background-color: transparent;
        color: #9e9e9e;
        cursor: pointer;
        outline: none;
      }
    }
  }

  & > ul.mui-dropdown-list {
    display: block;
    list-style-type: none;
    margin: 0;
    max-height: 216px;
    overflow-x: hidden;
    overflow-y: auto;
    & > li {
      font-size: 13px;
      line-height: 36px;
      color: #333;
      cursor: pointer;
      display: flex;

      & > div {
        display: flex;
        flex: 1;
        width: 100%;
        &:hover {
          background-color: #f5f5f5;
        }
        &.mui-dropdown-arrow {
          width: calc(100% - 36px);
        }

        & > .mui-dropdown-label {
          display: inline-block;
          padding: 0 15px;
          flex: 1;
          height: 36px;
          vertical-align: middle;
          white-space: nowrap;
          overflow: hidden;
          text-overflow: ellipsis;
        }
      }

      i.icon.mui-dropdown-arrow {
        font-size: 14px;
        line-height: 20px;
        width: 20px;
        text-align: center;
        padding: 8px;
        vertical-align: middle;
        color: #95989a;
        box-sizing: content-box;
        &:hover {
          background-color: #efefef;
        }
      }

      span.mui-dropdown-check-icon {
        display: inline-block;
        width: 18px;
        height: 18px;
        line-height: 20px;
        padding: 9px 15px;
        position: relative;
        box-sizing: content-box;
        & > .mui-dropdown-rect {
          display: inline-block;
          width: 18px;
          height: 18px;
          box-sizing: border-box;
          border: solid 1px #95989a;
          border-radius: 3px;

          i.icon {
            display: none;
            color: #fff;
            font-size: 14px;
            width: 18px;
            line-height: 18px;
            text-align: center;
            vertical-align: top;
          }
        }

        & + .mui-dropdown-label {
          padding-left: 0;
        }
      }

      &.mui-dropdown-item-checked {
        span.mui-dropdown-check-icon {
          & > .mui-dropdown-rect {
            border: none;

            i.icon {
              display: inline-block;
            }
          }
        }
        &.mui-dropdown-item-disabled {
          span.mui-dropdown-check-icon {
            & > .mui-dropdown-rect {
              background-color: #ccc;
            }
          }
        }
      }

      &.mui-dropdown-header {
        color: #999;
        cursor: default;
        padding: 0 15px;
        & div:hover,
        &.mui-dropdown-checked div {
          background-color: transparent;
        }
      }

      &.mui-dropdown-item-disabled {
        background-color: #f1f1f1;
        color: #999;
        cursor: not-allowed;
        & div:hover,
        &.mui-dropdown-checked div {
          background-color: #f1f1f1;
          color: #999;
        }
        i.icon {
          color: rgba(0, 0, 0, 0.3);
          &:hover {
            color: rgba(0, 0, 0, 0.3);
            background-color: #f1f1f1;
          }
        }
      }
    }
  }
}

.mui-dropdown-pills {
  list-style-type: none;
  padding: 2px 10px;
  font-size: 0;
  max-height: 120px;
  overflow-x: hidden;
  overflow-y: auto;

  & > li {
    display: inline-flex;
    font-size: 13px;
    line-height: 24px;
    padding: 0 6px;
    padding-left: 12px;
    margin: 4px 2px;
    border-radius: 12px;
    background-color: #efefef;
    cursor: default;
    user-select: none;
    max-width: 100%;

    & > .mui-dropdown-pills-label {
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }

    span {
      flex: 1;
      color: #333;
    }

    i.icon {
      display: inline-block;
      width: 24px;
      height: 24px;
      font-size: 18px;
      line-height: 24px;
      text-align: center;
      cursor: pointer;
      color: #9e9e9e;
    }

    &:hover {
      background-color: rgba(244, 64, 54, 0.2);

      i.icon {
        color: #757575;
      }
    }
  }
}
